package com.itbaizhan.controller;

import com.itbaizhan.pojo.Order;
import com.itbaizhan.result.BaseResult;
import com.itbaizhan.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author spf
 * @date 2024/3/8
 * @time 17:22
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/findOrders")
    public BaseResult<List<Order>> findOrders(@RequestParam("user") String user){
        List<Order> orders = orderService.getOrders(user);
        return BaseResult.ok(orders);
    }

}
